<template>
  <div class="info-box">
    <Cell class="cell-box cell-box1">
      <div class="my-box">
        <img src="../../assets/image/avatar-default.png" alt />
      </div>

      <template slot="title">
        <div class="custom-text img-text">头像</div>
      </template>
    </Cell>
    <Cell
      v-for="(item,index) in myList"
      @click="showBtn(item.path)"
      :key="index"
      :class="{'cell-box2':item.status!=1}"
      class="cell-box"
    >
      <div class="img-box">{{item.menuInfo}} {{index == 0 ? ">" : ''}}</div>

      <template slot="title">
        <span class="custom-text">{{item.menuName}}</span>
      </template>
    </Cell>
  </div>
</template>

<script>
import { Cell } from "vant";
export default {
  components: {
    Cell,
  },
  data() {
    return {
      myList: [
        {
          menuName: "名字",
          menuInfo: "",
          path: "/editname",
          status: 0,
        },
        {
          menuName: "手机",
          menuInfo: "",
          path: null,
          status: 0,
        },
        {
          menuName: "微信",
          menuInfo: "",
          path: null,
          status: 0,
        },
        {
          menuName: "当前企业",
          menuInfo: "",
          path: null,
          status: 0,
        },
      ],
    };
  },
  methods: {
    getUserInfo() {
      const userInfo = JSON.parse(localStorage.userInfo);
      this.myList[0].menuInfo = userInfo.userName;
      this.myList[0].path = "/editname?name=" + userInfo.userName;
      this.myList[1].menuInfo = userInfo.phone;
      this.myList[2].menuInfo = userInfo.hasBindWx == -1 ? "绑定" : "已绑定";
      this.myList[3].menuInfo = userInfo.enterpriseName || "未设置企业";
    },
    showBtn(path) {
      this.$router.push({
        path: path,
      });
    },
  },
  mounted() {
    this.getUserInfo();
  },
};
</script>

<style lang="stylus" scoped>
@import './../../assets/styl/mixin.styl'
.bottom-box
  position fixed
  bottom 0
  z-index 2
  background $infoColor
.cell-box
  display flex
  justify-content space-between
  font-size rem($ft16)
  align-items center
  .menu-items
    display flex
    justify-content flex-start
    align-items center
    color #333
  .my-box
    width rem(45)
    height rem(45)
    margin-left 65%
    text-align right
    img
      height 100%
      width 100%
  .img-text
    height rem(60)
    line-height rem(60)
.cell-box1
  .van-cell__right-icon
    height rem(67.83)
    line-height rem(67.83)
.cell-box2
  // margin-right rem(16)
</style>
<style lang="stylus" scoped>
@import './../../assets/styl/mixin.styl'
.van-cell::after
  right 0 !important
.cell-box2 .van-icon::before
  display none
</style>